/**
 * Copyright (c) 2018 qar All rights reserved.
 *
 * https://www.qar.io
 *
 * 版权所有，侵权必究！
 */

package com.example.mybatis.entity;

//import com.example.commons.mybatis.annotation.DataFilter;

import com.example.mybatis.annotation.DataFilter;

import java.util.List;

/**
 * 数据范围
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0
 */
public class DataScope {
    //表别名
    private String tableAlias;
    //数据权限字段
    private String dataScopeColumn;
    //用户ID字段
    private String userIdColumn;

    //数据权限
    private List<String> dataScopeList;
    //用户ID
    private Long userId;

    public DataScope(DataFilter dataFilter){
        this.tableAlias = dataFilter.tableAlias();
        this.dataScopeColumn = dataFilter.dataScope();
        this.userIdColumn = dataFilter.userId();
    }

    public String getTableAlias() {
        return tableAlias;
    }

    public void setTableAlias(String tableAlias) {
        this.tableAlias = tableAlias;
    }

    public String getDataScopeColumn() {
        return dataScopeColumn;
    }

    public void setDataScopeColumn(String dataScopeColumn) {
        this.dataScopeColumn = dataScopeColumn;
    }

    public String getUserIdColumn() {
        return userIdColumn;
    }

    public void setUserIdColumn(String userIdColumn) {
        this.userIdColumn = userIdColumn;
    }

    public List<String> getDataScopeList() {
        return dataScopeList;
    }

    public void setDataScopeList(List<String> dataScopeList) {
        this.dataScopeList = dataScopeList;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    @Override
    public String toString() {
        return "DataScope{" +
                "tableAlias='" + tableAlias + '\'' +
                ", dataScopeColumn='" + dataScopeColumn + '\'' +
                ", userIdColumn='" + userIdColumn + '\'' +
                ", dataScopeList=" + dataScopeList +
                ", userId=" + userId +
                '}';
    }
}